const convertIdListToObjList = function(idList, baseList) {
    if(idList.length === 0 || baseList.length === 0) {
        return []
    }

    let objList = idList;
    baseList.forEach(item => {
        let id = idList.findIndex(id => id === item.id);
        !isNaN(id) && objList.splice(id, 1, item)
    });

    return objList
}

const convertObjListToIdList = function(objList) {
    if(objList.length === 0) {
        return []
    }

    let idList = [];
    objList.forEach(item => idList.push(item.id));

    return idList;
}

export default {
    convertIdListToObjList,
    convertObjListToIdList
}
